package janela;

import java.awt.BorderLayout;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLCapabilities;
import javax.swing.JFrame;

import cena.Mundo;

public class Frame extends JFrame {

	private static final long serialVersionUID = 1L;
	private Mundo mundo = new Mundo();

	public Frame() {

		super("Trabalho N3");
		setBounds(400, 100, 500, 522);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		getContentPane().setLayout(new BorderLayout());

		GLCapabilities capabilities = new GLCapabilities();
		capabilities.setRedBits(8);
		capabilities.setGreenBits(8);
		capabilities.setBlueBits(8);
		capabilities.setAlphaBits(8);

		GLCanvas canvas = new GLCanvas(capabilities);

		canvas.addGLEventListener(mundo);
		canvas.addKeyListener(mundo);
		canvas.addMouseListener(mundo);
		canvas.addMouseMotionListener(mundo);

		add(canvas, BorderLayout.CENTER);
		canvas.requestFocus();
	}

	public static void main(String[] args) {

		new Frame().setVisible(true);
	}

}
